package com.hycat.mail.common.model;

import java.text.MessageFormat;

/**
 * @author : lzhycat
 * @date : 2022-07-19 15:48
 * 10000~19999 系统
 * 20000~29999 product
 * 30000~39999 order
 * 40000~49999 member
 * 50000~59999 ware
 */
public enum ExceptionEnum {
    UN_KNOW_EXCEPTION("10000", "未知异常，请联系浩业哥"),
    PARAM_VERIFY_EXCEPTION("10001", "参数校验异常"),

    CATEGORY_BRAND_RELATION_PARAM_UPDATE_EXCEPTION("20000", "分类-品牌-关联表更新异常"),
    GET_STOCK_ERROR("20001", "获取库存消息失败, {0}"),
    SKU_ES_UP_EXCEPTION("20002", "SKU商品上架ES异常"),

    ORDER_SKU_STOCK_NOT_ENOUGH("20003", "订单中商品库存不足 skuId = {0}"),
    ORDER_SKU_CHECK_IS_FALSE("20004", "订单中商品已经下架 skuId = {0}"),
    ORDER_CLICK_TO_FAST("20005", "订单提交过于频繁, 请重新再试"),
    ORDER_WARE_SKU_NOT_ENOUGH("20006", "{0}订单库存不足"),

    MEMBER_CODE_NOT_EXIST("40000", "用户注册验证码已失效或未发送"),
    MEMBER_CODE_ERROR("40001", "用户注册验证码错误"),
    MEMBER_MOBILE_EXIST("40002", "该手机号已被注册"),
    MEMBER_USERNAME_EXIST("40003", "该用户名已被注册"),
    MEMBER_USERINFO_NOT_EXIST("40004", "用户名或手机号不存在"),
    MEMBER_PASSWORD_NOT_EXIST("40005", "密码错误"),
    MEMBER_NOT_LOGIN("40006", "请登录后操作"),
    MEMBER_LOGIN_JSON("40007", "登录参数序列化失败"),

    WARE_SKU_STOCK_ERROR("50001", "库存不足, 请刷新页面");


    private final String code;
    private final String msg;

    ExceptionEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

/*    public String getMessage(Object ... args) {
        return MessageFormat.format(this.msg, args);
    }*/
}
